package com.godman.liu.loggingdemo.filter;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.servlet.*;
import java.io.IOException;

@Component
public class TestFilter implements Filter {

    @Value("${state.vivi}")
    private String vivi;

    @Value("${state.isnow}")
    private boolean isnow;

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("TestFilter,vivi:" + vivi);
        System.out.println("TestFilter,isnow:" + isnow);

        filterChain.doFilter(servletRequest, servletResponse);
    }

    @Override
    public void destroy() {

    }
}
